import VueRouter from "vue-router";
import Home from "../pages/Home.vue"
import Matching from "../pages/Matching.vue"
import NewsDetail from "../pages/NewsDetail.vue"
import MatchingDetail from "../pages/MatchingDetail.vue"
import CompanyDetail from "../pages/CompanyDetail.vue"
import ResourceDetailPro from "../pages/ResourceDetailPro.vue"
import ResourceDetailPer from "../pages/ResourceDetailPer.vue"
import ResourceDetailFin from "../pages/ResourceDetailFin.vue"
import News from "../pages/News.vue"
import Company from "../pages/Company.vue"
import Resource from "../pages/Resource.vue"
import AboutUs from "../pages/AboutUs.vue"
import UserCenter from "../pages/UserCenter.vue"
import Service from "../pages/Service.vue"
import ServiceDetail from "../pages/ServiceDetail.vue"
import AddForm from "../pages/AddForm.vue"
import Expert from "../pages/Expert.vue"
import ExpertDetail from "../pages/ExpertDetail.vue"
import Industry from "../pages/Industry.vue"
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}
const router = new VueRouter({
    routes: [{
        path: '/',
        name: 'Home',
        component: Home,
        // meta: {
        //     activeNum: 0,
        //     keepAlive: false
        // }
    }, {
        path: '/matching',
        name: 'Matching',
        component: Matching,
    }, {
        path: '/industry',
        name: 'Industry',
        component: Industry,
    }, {
        path: '/company',
        name: 'Company',
        component: Company,
        // meta: { keepAlive: true }
    }, {
        path: '/news',
        name: 'News',
        component: News,

    }, {
        path: '/resource',
        name: 'Resource',
        component: Resource,

    }, {
        path: '/newsdetail',
        name: 'NewsDetail',
        component: NewsDetail,
    }, {
        path: '/companydetail',
        name: 'CompanyDetail',
        component: CompanyDetail,
    }, {
        path: '/matchingdetail',
        name: 'MatchingDetail',
        component: MatchingDetail,
    }, {
        path: '/resourcedetaipro',
        name: 'ResourceDetailPro',
        component: ResourceDetailPro,
    }, {
        path: '/resourcedetailper',
        name: 'ResourceDetailPer',
        component: ResourceDetailPer,
    }, {
        path: '/resourcedetailfin',
        name: 'ResourceDetailFin',
        component: ResourceDetailFin,
    }, {
        path: '/aboutus',
        name: 'AboutUs',
        component: AboutUs,
    }, {
        path: '/usercenter',
        name: 'UserCenter',
        component: UserCenter,
    }, {
        path: '/service',
        name: 'Service',
        component: Service,
    }, {
        path: '/servicedetail',
        name: 'ServiceDetail',
        component: ServiceDetail,
    }, {
        path: '/expert',
        name: 'Expert',
        component: Expert,
    }, {
        path: '/addForm',
        name: 'AddForm',
        component: AddForm,
    }, {
        path: '/expertDetail',
        name: 'ExpertDetail',
        component: ExpertDetail,
    }]
})
router.beforeEach((to, from, next) => {
    document.body.scrollTop = 0
        // firefox
    document.documentElement.scrollTop = 0
    next()
})

export default router